package com.third.base.kuaidi100;

import java.util.ArrayList;


public class TrackResult {

	private String address = "";//	快递地址
	private String message = "";//	消息体，请忽略
	private String nu = "";//快递单号
	private String ischeck = "0";//是否签收标记，请忽略，明细状态请参考state字段
	private String com = "";//快递名称
	private String status = "0";//通讯状态，200成功
	private ArrayList<ResultItem> data = new ArrayList<ResultItem>();
	private int state;//快递单当前签收状态，包括0在途中、1已揽收、2疑难、3已签收、4退签、5同城派送中、6退回、7转单等7个状态，其中4-7需要另外开通才有效
	private String condition = "";	//快递单明细状态标记，暂未实现，请忽略
	public String getMessage() {
		return message;
	}
	public String getNu() {
		return nu;
	}
	public String getIscheck() {
		return ischeck;
	}
	public String getCom() {
		return com;
	}
	public String getStatus() {
		return status;
	}
	public ArrayList<ResultItem> getData() {
		return data;
	}
	public String getCondition() {
		return condition;
	}
	public void setMessage(String message) {
		this.message = message;
	}
	public void setNu(String nu) {
		this.nu = nu;
	}
	public void setIscheck(String ischeck) {
		this.ischeck = ischeck;
	}
	public void setCom(String com) {
		this.com = com;
	}
	public void setStatus(String status) {
		this.status = status;
	}
	public void setData(ArrayList<ResultItem> data) {
		this.data = data;
	}
	public void setCondition(String condition) {
		this.condition = condition;
	}
	
	public String getAddress() {
		return address;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	
	public int getState() {
		return state;
	}
	public void setState(int state) {
		setAddress(checkAddress(state));
		this.state = state;
	}
	
	
	    
	@Override
	public String toString() {
		return "Result [address=" + address + ", message=" + message + ", nu=" + nu + ", ischeck=" + ischeck + ", com="
				+ com + ", status=" + status + ", data=" + data + ", state=" + state + ", condition=" + condition + "]";
	}
	//0在途中、1已揽收、2疑难、3已签收、4退签、5同城派送中、6退回、7转单 等7个状态，其中4-7需要另外开通才有效
	public String checkAddress(int code) {
			switch (code) {
			case 0:
				
				return "在途中";
			case 1:
				
				return "已揽收";
			case 2:
				
				return "疑难";
			case 3:
				
				return "已签收";
			case 4:
				
				return "退签";
			case 5:
				
				return "同城派送中";
			case 6:
				
				return "退回";
			case 7:
				
				return "转单";

			default:
				return "在途中";
			}
	}

}
